<template>
  <div class="category-list">
    <div class="category-item" v-for="data in props.categoryList" :key="1" :class="{ selected: props.selectedKey === data.title }">
      <p>{{ data.title }}</p>
    </div>
  </div>
</template>

<script setup lang="ts">
import { defineProps } from "vue";

export type TCategoryList = {
  title: string;
};

interface Props {
  categoryList: TCategoryList[];
  selectedKey: string;
}

const props = defineProps<Props>();
</script>

<style lang="scss" scoped>
.category-list {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;

  .category-item {
    margin: 5px 15px;
    font-size: 14px;
    color: #666;
    padding: 3px 5px;
    cursor: pointer;
    @include Hover($main-color, color);
  }

  .selected {
    background: #ebfefb;
    color: $main-color;
  }
}
</style>
